package com.igeek.javase.ch04.ordersByTeacher;

import java.util.Date;

/**
 * @description TODO
 * @author chenmin
 * 2023/7/14 9:17
 */
public class Test {

    public static void main(String[] args) {
        //商品
        Goods g1 = new Goods("话筒" , "声音清晰" , new Date() , 9.9);
        Goods g2 = new Goods("笔记本" , "耐摔" , new Date() , 6669.9);
        Goods g3 = new Goods("鼠标" , "灵活" , new Date() , 19.9);
        Goods[] goods1 = {g1 , g2 , g3};
        Goods[] goods2 = {g1 , g3};

        //用户
        User user = new User("张三" , "安徽合肥" , "12312312313");

        //订单
        Orders orders1 = new Orders("001L" , user , goods2);
        Orders orders2 = new Orders("002L" , user , goods1);
        Orders[] orders = {orders1 , orders2};

        //测试方法
        //下单
        user.setOrders(orders);
        user.xiaDan();

        //订单详情
        orders1.showOrderDetail();
        System.out.println("------------------------------------");
        orders2.showOrderDetail();

        //StackOverflowError  堆栈溢出错误，由于User和Orders之间是双向关联
        //System.out.println(user);
        //System.out.println(orders1);
    }

}
